Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port openlibm log1pf as log1p #239

Merged
merged 4 commits into from
Aug 15, 2023
Merged

Conversation

sotlampr
Copy link
Contributor

(Replaces #236)
Base.Math.log1p calculation relies on two procedures , log_proc1 and log_proc2 from the literature Tang (1990). The current implementation upscales to Float64 internally and as such is incompatible with Metal.

See also relevant discussions #234, #236

This PR ports log1pf from openlibm

Error Analysis (ULP) (Ran on CPU)

This implementation v. the original C implementation (Float32)

max 1.0 at x = 3.0777041e38
mean 0.00010909553601139363

This implementation v. Base.Math.log1p(::Float64)

max 0.8388471007347107 at x = 0.40553576
mean 0.11881815022236436

This implementation v. Base.Math.log1p(::Float32)

max 1.0 at x = 3.4005017e38
mean 0.003624081612764254

Error Analysis (ULP) (Ran on GPU using 100,000 points)

v. Base.Math.log1p(::Float64)

max 0.5023159980773926 at x = 2.3837697e38
mean 0.24963651393659414

v. Base.Math.log1p(::Float32)

max 1.0 at x = 3.2846083e38
mean 0.00113

@sotlampr
Copy link
Contributor Author

@oscardssmith

@oscardssmith
Copy link

Looks great!

@maleadt
Copy link
Member

maleadt commented Aug 15, 2023

Thanks! At some point we'll want to move this into a shared package, as oneAPI also doesn't support Float64, but we can keep it here for now.

@maleadt maleadt merged commit e9efcff into JuliaGPU:main Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants